package com.example.novel.contorller;

import com.example.novel.domain.Book;
import com.example.novel.service.IbookService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 控制层
 */
@Controller
@RequestMapping("/ranking")
@CrossOrigin
public class rankingContorller {

    @Autowired
    private IbookService bookService;

    //收藏榜
    @ResponseBody
    @ApiOperation("收藏榜")
    @GetMapping("collectionlist")
    public List<Book> getCollectionList() {
        return bookService.getCollectionList();
    }
    //更新榜
    @ResponseBody
    @ApiOperation("更新榜")
    @GetMapping("updateList")
    public List<Book> getUpdateList() {
        return bookService.getUpdateList();
    }
}
